--#include "data\functions\Activity\BackStageActivity\DailyRecharge.lua"   once         -- 每日充值
--#include "data\functions\Activity\BackStageActivity\TimeLimitShopping.lua"   once         -- 限时商品
--#include "data\functions\Activity\BackStageActivity\TotalRecharge.lua"   once         -- 累计充值
--#include "data\functions\Activity\BackStageActivity\TotalCost.lua"   once         -- 累计消费

--请求已经开启的后台活动
function OnSendBackStageActivity(sysarg)
	--print("OnSendBackStageActivity")
	local activitys = {}
	for idx = CommonActivity_DailyRecharge, CommonActivity_MAX - 1 do
		local commonActivityState = not GetBackStageActivityStateByActivityId(sysarg, idx)
		if System.IsCommonActivityOpen(idx) and commonActivityState then
			--print("commonActivityState11111111")
			local leftTime = System.GetCommonActivityLeftTime(idx)
			local nPlan = System.GetCommonActivityParam(idx,0,0,0,0)
			local data = {}
			data.activityId = idx
			data.leftTime = leftTime
			data.plan = nPlan
			data.day = GetBackStageActivityDayByActivityId(idx)
			table.insert(activitys, data)
		end
	end
	if #activitys > 0 then
		SendOpenCommonActivity(sysarg, activitys )
	end
end

--根据活动id获取活动状态
function GetBackStageActivityStateByActivityId(sysarg, actId)
	if actId == CommonActivity_DailyRecharge then
		return GetDailyRechargeState(sysarg)
	elseif actId == CommonActivity_TimeLimitShopping then
		return GetTimeLimitShoppingState(sysarg)
	elseif actId == CommonActivity_TotalRecharge then
		return GetTotalRechargeState(sysarg)
	elseif actId == CommonActivity_TotalCost then
		return GetTotalCostState(sysarg)
	end
	return true
end